package com.mrx.bot.telegram;

import com.fasterxml.jackson.databind.ObjectMapper;
import com.mrx.bot.telegram.config.OkhttpConfig;
import com.mrx.bot.telegram.impl.StickDownloaderBot;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.telegram.telegrambots.longpolling.TelegramBotsLongPollingApplication;

/**
 * @author Mr.X
 * @since 2025/6/13 20:52
 */
public class TelegramBotApplication {

    private static final Logger logger = LoggerFactory.getLogger(TelegramBotApplication.class);

    public static void main(String[] args) throws Exception {
        logger.info("启动程序");
        try (var application = new TelegramBotsLongPollingApplication(ObjectMapper::new, OkhttpConfig.INSTANCE)) {
            StickDownloaderBot bot = new StickDownloaderBot();
            bot.onRegister();
            application.registerBot(bot.getToken(), bot);
            Thread.currentThread().join();
        }
        logger.info("终止程序");
    }

}